package com.twu.biblioteca;

public class Movie implements Borrowable {
    private int customerId;
    private int movieId;
    private final int rating;
    private final int year;
    private final String title;
    private final String director;

    public Movie(int rating, int year, String title, String director)
    {
        this.rating = rating;
        this.year = year;
        this.title = title;
        this.director = director;
    }

    @Override
    public void setCustomerId(int customerId) {
        this.customerId = customerId;
    }

    @Override
    public int getCustomerId() {
        return customerId;
    }

    @Override
    public int getItemId() {
        return movieId;
    }

    @Override
    public void setItemId(int movieId) {
        this.movieId = movieId;
    }

    public int getRating()
    {
        return rating;
    }

    public String printRating()
    {
        if(rating == 0)
        {
           return "N/A";
        }
        return Integer.toString(rating);
    }

    public int getYear() {
        return year;
    }

    public String getTitle() {
        return title;
    }

    public String getDirector() {
        return director;
    }

    @Override
    public String toString()
    {
       return String.format("%s\t%d\t%s\t%s", getTitle(), getYear(), getDirector(), printRating());
    }
}
